<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: id
  Date: 2021/1/14
  Time: 16:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page  isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../util/makerAndenterGoodAndselect1.jsp"%>
<html>
<head>
    <title>ADD Maker1</title>
    <style type="text/css">
        #add{
            width: 1288px;
            height:1000px;
            position: absolute;
            top: 60px;
            left: 83px;
        }

        .fr{
            width: 400px;
            height: 300px;
            position: relative;
            left: 480px;
            top: 50px;
        }
        span{
            color: cadetblue;
        }
        input{
            text-align: center;
        }
    </style>
    <script type="text/javascript" src="../../../static/jquery-3.4.1.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#add").hover(function () {
                    $("#d3").hide()
                    $("#xs").hide()
                    $("#d2").hide()
                    $("#d4").hide()
                }
            )


            /*效验*/
            var fl=true;
            var re =/[\u4e00-\u9fa5]/;  //中文
            var reg = /^[0-9]+.?[0-9]*$/;           //数字
            var reg2 = /^[A-Za-z]+$/ //字母
            var reg3 = /^(?!\d+$)(?![a-zA-Z]+$)[a-zA-Z\d]+$/ //;//字母和数字

            let forname = $("#forname").val();
            var whe = $("#whe").val();
            var data1 = $("#data1").val();
            if(forname==null || forname==""||whe==null || whe==""||data1==null || data1==""){
                $("#s1").html("?")
                $("#s2").html("?")
                $("#s3").html("?")
                fl=false;
            }else {
                fl=true;
            }


            $("#forname").blur(function () {
                if($("#forname").val()==null ||$("#forname").val()==""){
                    $("#s1").html("请填写客户名称")
                    fl=false;
                }else if(reg.test($("#forname").val())){
                    $("#s1").html("客户名称不能为数字")
                    fl=false;
                } else {
                    $("#s1").html("√")
                    fl=true;
                }
            })

            $("#whe").blur(function () {
                if($("#whe").val()==null ||$("#whe").val()==""){
                    $("#s2").html("请填写客户地址")
                    fl=false;
                }else if(reg.test($("#whe").val())){
                    $("#s2").html("客户地址不能为数字")
                    fl=false;
                }
                else {
                    $("#s2").html("√")
                    fl=true;
                }
            })

            $("#data1").blur(function () {
                if($("#data1").val()==null ||$("#data1").val()==""){
                    $("#s3").html("请填写日期")
                    fl=false;
                }else {
                    $("#s3").html("√")
                    fl=true;
                }
            })

            /*表单验证*/
            $("Form").submit(function () {
                return fl;
            })

        })



    </script>
</head>
<body>
<div id="add">
    <div class="fr">
        <form action="${pageContext.request.contextPath}/Maker1/addMakerOK">
            <span>客户名称:</span>
            <input type="text" name="forname" style="width: 170px;height: 30px;border-radius: 6px" id="forname">
            <span id="s1" style="color: red"></span>
            <br><br>
            <span>地址:</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="text" name="whe" style="width: 170px;height: 30px;border-radius: 6px" id="whe">
            <span id="s2" style="color: red"></span>
            <br><br>
            <span>商品类型:</span>
            <select name="goodstyle" style="width: 170px;height: 30px;border-radius: 6px">
                <c:forEach items="${goodStyleList}" var="a">
                    <option value="${a.gId}">${a.gName}</option>
                </c:forEach>
            </select><br><br>

            <span> 业务日期:</span> <input type="date" name="data1" style="width: 170px;height: 30px;border-radius: 6px" id="data1">
            <span id="s3" style="color: red"></span>
            <br><br>

            <span>入仓之库:</span>
            <select name="rid" style="width: 170px;height: 30px;border-radius: 6px">
                <c:forEach var="c" items="${reList}">
                    <option value="${c.rid}">${c.rName}</option>
                </c:forEach>
            </select><br><br>

            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="submit" value="Add to" style="width: 170px;height: 30px;border-radius: 6px">
        </form>
    </div>
</div>
</body>
</html>
